import axios from "axios"
import { GET_TOKEN } from "./token"
const token =GET_TOKEN();
const request = axios.create({
    timeout:15000,
    baseURL: "http://geek.itheima.net/v1_0",
})

request.interceptors.request.use(config => {
    if(token){
        config.headers.Authorization = `Bearer ${token}`
    }
    return config
})

request.interceptors.response.use((response) => {

    return response
})

export default request
